package com.gc.ykqx.service.entity;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by clem on 2017/3/22.
 */
public class Site implements Parcelable, Serializable {
    private String stationId;//站号
    private String station_name;//站名
    private String lat;//纬度
    private String lon;//经度
    private Map<String,String> timeValue;
    private String value;


    public Site() {
    }

    public Site(String stationId, String station_name, String lat, String lon, Map<String, String> timeValue) {
        this.stationId = stationId;
        this.station_name = station_name;
        this.lat = lat;
        this.lon = lon;
        this.timeValue = timeValue;
    }

    public String getStationId() {
        return stationId;
    }

    public void setStationId(String stationId) {
        this.stationId = stationId;
    }

    public String getStation_name() {
        return station_name;
    }

    public void setStation_name(String station_name) {
        this.station_name = station_name;
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }

    public String getLon() {
        return lon;
    }

    public void setLon(String lon) {
        this.lon = lon;
    }

    public Map<String, String> getTimeValue() {
        return timeValue;
    }

    public void setTimeValue(Map<String, String> timeValue) {
        this.timeValue = timeValue;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }


    /*    private Map<String, Wea> weaMap;//保存当前的要素信息
    private String title;//显示标题
    private String value;//值*/


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.stationId);
        dest.writeString(this.station_name);
        dest.writeString(this.lat);
        dest.writeString(this.lon);
        dest.writeInt(this.timeValue.size());
        for (Map.Entry<String, String> entry : this.timeValue.entrySet()) {
            dest.writeString(entry.getKey());
            dest.writeString(entry.getValue());
        }
        dest.writeString(this.value);
    }

    protected Site(Parcel in) {
        this.stationId = in.readString();
        this.station_name = in.readString();
        this.lat = in.readString();
        this.lon = in.readString();
        int timeValueSize = in.readInt();
        this.timeValue = new HashMap<String, String>(timeValueSize);
        for (int i = 0; i < timeValueSize; i++) {
            String key = in.readString();
            String value = in.readString();
            this.timeValue.put(key, value);
        }
        this.value = in.readString();
    }

    public static final Creator<Site> CREATOR = new Creator<Site>() {
        @Override
        public Site createFromParcel(Parcel source) {
            return new Site(source);
        }

        @Override
        public Site[] newArray(int size) {
            return new Site[size];
        }
    };
}
